package com.jy.api.misc;

import com.alibaba.fastjson.JSONArray;
import com.jy.api.misc.dto.*;
import com.jy.framework.base.entity.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author yuyue
 * @date 2022/1/21R
 */
@FeignClient(name = "misc", fallback = MiscAPIFallback.class)
public interface MiscAPI {
    @GetMapping("/jy/specification/wsdic/zhiYuList")
    @ApiOperation("根据编码精准查出相关")
    List<BiaoZhunZYDto> getZhiYuList(@RequestParam("zhiYuDM") String zhiYuDM);

    @GetMapping("/jy/casehistory/tj")
    Result<MoKuaiTJDto> bingLiFYTJ(@RequestParam("hospitalId") String hospitalId,
                                   @RequestParam("beginTime") String beginTime,
                                   @RequestParam("endTime") String endTime);

    @GetMapping("/jy/specification/yaoping/getYaoPingByIds")
    List<ShouCangYaoPinDto> getYaoPingByIds(@RequestParam("ids") List<String> ids);

    @GetMapping("/task/produceRenwu")
    Result produceRenwu();

    @GetMapping("/task/sendMessage")
    Result sendMessage();

    @GetMapping("/jy/casehistory/updateZhuangTaiTF")
    void updateGuoQiZT();

    @GetMapping("/jy/information/zixun/crawler")
    void produceZiXun();

    @GetMapping("shujujpzgl/hospitalYeWuLXYFP")
    @ApiModelProperty("根据医院ID和业务类型返回是否已分配")
    ShuJuJPZGLDto hospitalYeWuLXYFP(@RequestParam("hospitalId") String hospitalId, @RequestParam("yeWuLX") String yeWuLX);

    @PostMapping("/jiaoYanGZ/baoCun")
    Result baoCun(@RequestBody List<JiaoYanGZDto> jiaoYanGZList);

    @GetMapping("/jiaoYanGZ/list")
    @ApiOperation("后端根据根据业务类型获取校验规则")
    List<JiaoYanGZDto> getJiaoYanGZList(@RequestParam("yeWuLX") String yeWuLX);

    @ApiOperation(value = "获取所有质控管理规则")
    @GetMapping("/zhikonggz/getAllZhiKongQZ")
    Result<List<ZhiKongQZDto>> getAllZhiKongQZ();

    @GetMapping("/jy/specification/wsdic/getAllShuJuJSL")
    @ApiOperation("获取数据集总数")
    Integer getAllShuJuJSL();

    @GetMapping("/jy/specification/wsdic/listAllDiCengSJJ")
    @ApiOperation("获取所有底层接口数据集")
    List<ShuJuJGLDto> listAllDiCengSJJ();

    @ApiOperation(value = "获取数据集配置管理树")
    @GetMapping("/shujujpzgl/listShuJuJPZ")
    Result<ShuJuJPZDto> listShuJuJPZ(@RequestParam(value = "areaId", required = true) String areaId);

    @ApiOperation(value = "获取全部数据集配置管理树")
    @GetMapping("/shujujpzgl/listAllShuJuJPZ")
    Result<List<ShuJuJPZDto>> listAllShuJuJPZ();

    @ApiModelProperty("根据数据集名称查询数据集目录")
    @GetMapping("/jy/specification/wsdic/getShuJuJMLGL")
    @ResponseBody
    Result<List<ShuJuJGLDto>> findShuJuJMLGL(@RequestParam(value = "msg", required = false) String msg,
                                             @RequestParam(value = "type", required = false) Integer type);

    @GetMapping("wsdic/shujuJGL/yeWuLXByTableName")
    ShuJuJGLDto getYeWuLXByTableName(@RequestParam("tableName") String tableName);

    @GetMapping("/jiaoYanGZ/byYeWuLX")
    @ApiOperation("前端页面-根据业务类型获取质控方案配置")
    Result<JiaoYanGZDto> getJiaoYanGZByYeWuLX(@RequestParam(value = "yeWuLX") String yeWuLX);

    @GetMapping("wsdic/shujuJGL/mingChengByDM")
    ShuJuJGLDto getMingChengByDM(@RequestParam("shuJuJDM") String shuJuJDM);

    @GetMapping("/shujujlypz/getShuJuJLY")
    Result<ShuJuJLYDto> getShuJuJLY(@RequestParam(value = "routeId", required = true) String routeId);

    @GetMapping("/jy/specification/wsdic/getShuJuJListById")
    Result<ShuJuJXXDto> getShuJuJListById(@RequestParam(value = "shuJuJID", required = true) Long shuJuJID);

    @GetMapping("/quHuaDM/getShengShiXian")
    Result<List<QuHuaDMDto>> getShengShiXian();

    @GetMapping("/quHuaDM/getByParentId")
    Result<List<QuHuaDMDto>> getQuHuaDMByParentId(@RequestParam(value = "parentId", required = true) long parentId);

    @GetMapping("/quHuaDM/getByQuHuaDM")
    Result<QuHuaDMDto> getQuHuaDMByDM(@RequestParam(value = "quHuaDM", required = true) String quHuaDM);

    @GetMapping("/quHuaDM")
    Result<List<QuHuaDMDto>> getQuHuaDM(@RequestParam(value = "guanJianZi", required = false) String guanJianZi);

    @ApiOperation(value = "获取子区划代码")
    @GetMapping("/quHuaDM/getByParentQHDM")
    Result getByParentQHDM(@RequestParam(value = "quHuaDM") String quHuaDM);


    @GetMapping("/wssy/bianMaXT/countByCSBM")
    @ApiOperation("根据机构编码获取是否已有编码系统使用到")
    int getCountByJGID(@RequestParam("changShangBM") String changShangBM);

    @GetMapping("/zhikong/v2/tongJiShuJuJMX")
    Result<Boolean> tongJiShuJuJMX(@RequestParam(value = "hospitalId") String hospitalId, @RequestParam(value = "riQi") String riQi);

    @ApiOperation(value = "稳定性异常通知")
    @PostMapping("/zhikong/v2/wenDingXYCTZ")
    Result wenDingXYCTZ();

    @GetMapping("/wssy/TRS/jiZhiHQ")
    @ApiOperation("获取值集 IST-TR1")
    Result<WSSYBMXTDaiMaDto> jiZhiHQ(@RequestParam("id") String id);

    @PostMapping("/wssy/TRS/jiZhiCX")
    @ApiOperation("查询值集 IST-TR2")
    Result<List<ZhiYuDto>> jiZhiCX(@RequestBody ZhiJiCXDto req);

    @GetMapping("/wssy/TRS/jiZhiYSHQ")
    @ApiOperation("获取集值映射 IST-TR3")
    Result<ZhiYuYSMXDto> jiZhiYSHQ(@RequestParam("id") String id);

    @PostMapping("/wssy/TRS/jiZhiYSCX")
    @ApiOperation("查询集值映射 IST-TR4")
    Result<List<ZhiYuYSMXDto>> jiZhiYSCX(@RequestBody ISTTR4QueryDto req);

    @GetMapping("/wssy/zhiYu/exist")
    @ApiOperation("根据值域标识符判断是否存在该值域")
    Result<Boolean> zhiYuSFCZ(@RequestParam("zhiJiBSF") String zhiJiBSF, @RequestParam(value = "zhi", required = false) String zhi);

    @GetMapping({"/jy/specification/wsdic/getShuJuJGroup"})
    @ApiOperation("查询数据集分组")
    Result<Map<String, List<ShuJuJiDto>>> getShuJuJGroup();

    @GetMapping("/jy/specification/wsdic/listShuJuJ")
    @ApiOperation("查询数据集")
    Result<List<ShuJuJGLDto>> listShuJuJ();

    @GetMapping("/wssy/zhiYu/daiMaByZJBSF")
    @ApiOperation("根据值域标识符获取代码")
    Result<WSSYBMXTDaiMaDto> getDaiMaByZJBSF(@RequestParam("zhiJiBSF") String zhiJiBSF);

    @GetMapping("/wssy/zhiYuYS/getByMuBiaoZYBSFAndYCS")
    @ApiOperation("根据目标值域标识符及源厂商，获取值域映射")
    Result<ZhiYuYSMXDto> getByMuBiaoZYBSFAndYCS(@RequestParam("muBiaoZhiYuBSF") String muBiaoZhiYuBSF, @RequestParam("yuanCSId") String yuanCSId);

    @GetMapping("/wssy/zhiYu/daiMaByZJBSFList")
    @ApiOperation("根据值域标识符获取代码（列表）")
    Result<List<WSSYBMXTDaiMaDto>> getDaiMaByZJBSFList(@RequestParam("zhiJiBSFList") String[] zhiJiBSFList);

    @PostMapping("/wssy/zhiYu/getValueByCode")
    @ApiOperation("根据值域标识符和code获取value")
    Result<List<WSSYBMXTDaiMaDto>> getValueByCode(@RequestBody ZhiYuMXCXDto[] dto,
                                                  @RequestParam(required = false, defaultValue = "1", value = "mode") Integer mode);

    @GetMapping("/jy/specification/wsdic/getShuJuJByIds")
    @ApiOperation(value = "获取数据集字段根据id")
    Result<List<ShuJuJiDto>> getShuJuJByIds(@RequestParam("ids") List<String> ids);

    @PostMapping("/zhikong/v2/dingShiGLXPF")
    @ApiOperation("定时器跑关联性评分")
    void dingShiGLXPF();

    @GetMapping("shujuzk/sendTodayBGPF")
    @ApiOperation("根据日期推送报告评分")
    void sendTodayBGPF(@RequestParam(value = "date") String date);

    @PostMapping("dm/shuJuJZD/listByShuJuJIdList")
    @ApiOperation("逻辑模型-根据数据集ID list获取其下字段")
    Result<List<DMLuoJiMXSJJZDDto>> getShuJuJZDListByShuJuJIdList(@RequestBody List<String> shuJuJIdList);

    @PostMapping("/tieyuancheng/shuJuJZD/listByShuJuJIdList")
    @ApiOperation("逻辑模型-根据数据集ID list获取其下字段")
    Result<List<DMLuoJiMXSJJZDDto>> getTYCShuJuJZDListByShuJuJIdList(@RequestBody List<String> shuJuJIdList);


    @GetMapping("dm/shuJuJ/allFaBu")
    @ApiOperation("逻辑模型-获取所有已发布的数据集")
    Result<List<DMLuoJiMXSJJDto>> getAllFaBuShuJuJi();

    @GetMapping("/tieyuancheng/shuJuJ/allFaBu")
    @ApiOperation("逻辑模型-获取所有已发布的数据集")
    Result<List<DMLuoJiMXSJJDto>> getAllTYCFaBuShuJuJi();

    @GetMapping("/wssy/bianMaXT/exist")
    @ApiOperation("根据编码系统标识符及值、值含义判断值是否在编码系统中存在")
    Result<Boolean> bianMaXTZhiExist(@RequestParam("biaoShiFu") String biaoShiFu, @RequestParam("zhi") String zhi,
                                     @RequestParam(value = "zhiValue", required = false) String zhiValue);

    @PostMapping("/dm/shuJuJZD/mapByZiDuan")
    @ApiOperation("逻辑模型-根据字段list获取对应的表名及字段名")
    Result<JSONArray> getShuJuJZDMapByZiDuan(@RequestBody List<String> ziDuanList);

    @GetMapping("/yinSiBH/shuJuFJ/byFenJiLX")
    @ApiOperation("数据分级-根据分级类型获取对应字段list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jiBie", value = "级别 1: 公开，2: 敏感 3: 重要"),
    })
    Result<List<ShuJuFLDto>> getZiDuanListByFenJiLX(@RequestParam(value = "jiBie") Integer jiBie);

    @GetMapping("/dm/shuJuJ/listByLuoJiMXId")
    @ApiOperation("逻辑模型-数据集-根据逻辑模型ID获取其下所有数据集")
    Result<List<DMLuoJiMXSJJDto>> shuJuJListByLuoJiMXId(@RequestParam(required = false, value = "luoJiMXId") String luoJiMXId,
                                                        @RequestParam(required = false, value = "shuJuJId") String shuJuJId);


    @GetMapping("/dm/shuJuJ/subShuJuJ")
    @ApiOperation("逻辑模型-获取下级的数据集")
    Result<List<DMLuoJiMXSJJDto>> getSubShuJuJ(@RequestParam(value = "shangJiId", required = false) String shangJiId,
                                               @RequestParam(value = "shangJiMC", required = false) String shangJiMC);

    @PostMapping("/dm/DMPublishLog")
    @ApiOperation("数据模型-发布日志")
    Result DMPublishLog(@RequestBody DMlatestReleaseDto dto);

    @GetMapping("/wssy/shuJuYuan/detailByShuJuYuan")
    @ApiOperation("根据标识符查看详情")
    Result<ShuJuYuanDto> getDetailByShuJuYuan(@RequestParam("biaoShiFu") String biaoShiFu);

    @GetMapping("/jy/questionnaire/dingShiTS")
    @ApiOperation("定时推送当天问卷信息给就诊结束")
    void dingShiTS();

}
